const { exec } = require('child_process')

export function executeCommand(cmd) {
    return new Promise((resolve, reject) => {
        exec(cmd, (code, stdout, stderr) => {
            if (code) {
                reject(code);
            } else if (stderr) {
                reject(stderr);
            }
            else {
                resolve(stdout?.toString() || "");
            }
        })
    }).catch((e) => {
        console.log(e);
    })
}
